home *** CD-ROM | disk | FTP | other *** search
/ CICA 1995 August / CICA - The Ultimate Collection of Shareware for Windows (Disc 2) (August 1995).iso / disc2 / patches / symantec / rtlinc.exe / IOMDEFS.H < prev    next >
C/C++ Source or Header  |  1993-05-14  |  2KB  |  86 lines

  1. #ifndef __IOMDEFS_H
  2. #define __IOMDEFS_H
  3.  
  4. #include <iostream.h>
  5.  
  6. #pragma pack(__DEFALIGN)
  7. template <class T> class SMANIP {
  8. public:
  9.     SMANIP(ios &(*f)(ios&, T), T v) : func(f), val(v) {}
  10.     friend istream &operator>>(istream& s, SMANIP<T>& m)
  11.     { m.func(s, m.val); return s; }
  12.     friend ostream &operator<<(ostream& s, SMANIP<T>& m)
  13.     { m.func(s, m.val); return s; }
  14. private:
  15.     ios &(*func)(ios&, T);
  16.     T val;
  17. };
  18.  
  19. template <class T> class IMANIP {
  20. public:
  21.     IMANIP(istream &(*f)(istream&, T), T v) : func(f), val(v) {}
  22.     friend istream &operator>>(istream& s, IMANIP<T>& m)
  23.     { return m.func(s, m.val); }
  24. private:
  25.     istream &(*func)(istream&, T);
  26.     T val;
  27. };
  28.  
  29. template <class T> class OMANIP {
  30. public:
  31.     OMANIP(ostream &(*f)(ostream&, T), T v) : func(f), val(v) {}
  32.     friend ostream &operator<<(ostream& s, OMANIP<T>& m)
  33.     { return m.func(s, m.val); }
  34. private:
  35.     ostream &(*func)(ostream&, T);
  36.     T val;
  37. };
  38.  
  39. template <class T> class IOMANIP {
  40. public:
  41.     IOMANIP(iostream &(*f)(iostream&, T), T v) : func(f), val(v) {}
  42.     friend istream &operator>>(iostream& s, IOMANIP<T>& m)
  43.     { return m.func(s, m.val); }
  44.     friend ostream &operator<<(iostream& s, IOMANIP<T>& m)
  45.     { return m.func(s, m.val); }
  46. private:
  47.     iostream &(*func)(iostream&, T);
  48.     T val;
  49. };
  50.  
  51. template <class T> class SAPP {
  52. public:
  53.     SAPP(ios &(*f)(ios&, T)) : func(f) {}
  54.     SMANIP<T> operator()(T v) { return SMANIP<T>(func, v); }
  55. private:
  56.     ios &(*func)(ios&, T);
  57. };
  58.  
  59. template <class T> class IAPP {
  60. public:
  61.     IAPP(istream &(*f)(istream&, T)) : func(f) {}
  62.     IMANIP<T> operator()(T v) { return IMANIP<T>(func, v); }
  63. private:
  64.     istream &(*func)(istream&, T);
  65. };
  66.  
  67. template <class T> class OAPP {
  68. public:
  69.     OAPP(ostream &(*f)(ostream&, T)) : func(f) {}
  70.     OMANIP<T> operator()(T v) { return OMANIP<T>(func, v); }
  71. private:
  72.     ostream &(*func)(ostream&, T);
  73. };
  74.  
  75. template <class T> class IOAPP {
  76. public:
  77.     IOAPP(iostream &(*f)(iostream&, T)) : func(f) {}
  78.     IOMANIP<T> operator()(T v) { return IOMANIP<T>(func, v); }
  79. private:
  80.     iostream &(*func)(iostream&, T);
  81. };
  82.  
  83. #pragma pack()
  84.  
  85. #endif  // __IOMDEFS_H
  86.